package com.webdemo07.servlet;

import java.io.IOException;

import javax.servlet.GenericServlet;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.webdemo07.util.SpringHandler;

public class ProxyServlet extends GenericServlet {
	private static final long serialVersionUID = 1L;
	private String realServlet;
	private Servlet userServlet;
	@Override
	public void init() throws ServletException {
		this.realServlet = getInitParameter("realServlet");
		this.userServlet = (Servlet) SpringHandler.getApplicationContext().getBean(realServlet);
	}
	@Override
	public void service(ServletRequest request, ServletResponse response)
			throws ServletException, IOException {
		userServlet.service(request, response);
	}
}
